package com.shenmazong.servereduschool.controller;


import com.shenmazong.servereduschool.entity.TbMajor;
import com.shenmazong.servereduschool.service.ITbMajorService;
import com.shenmazong.utils.ResultResponse;
import com.shenmazong.vo.BatchChooseIdVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 专业表——suliven 前端控制器
 * </p>
 *
 * @author 关好帅
 * @since 2021-09-22
 */
@RestController
@RequestMapping("/major")
public class TbMajorController {
    @Autowired
    private ITbMajorService majorService;

    /**
     * @description 创建专业
     * @author GuanJiaHe
     * @date 2021/9/22 13:58
     * @version 1.0
     */
    @PostMapping("createMajor")
    public ResultResponse createMajor(@RequestBody TbMajor major){
        return majorService.createMajor(major);
    }

    /**
     * @description 通过专业id删除专业
     * @author GuanJiaHe
     * @date 2021/9/22 13:58
     * @version 1.0
     */
    @DeleteMapping("deleteMajor")
    public ResultResponse deleteMajor(@RequestBody BatchChooseIdVo idVo){
        return majorService.deleteMajor(idVo);
    }

    /**
     * @description 修改专业
     * @author GuanJiaHe
     * @date 2021/9/22 13:58
     * @version 1.0
     */
    @PostMapping("updateMajor")
    public ResultResponse updateMajor(@RequestBody TbMajor major){
        return majorService.updateMajor(major);
    }
}
